package strategy;

import java.math.BigDecimal;

public class StrategyFactory {

  public static void main(String[] args) {
    BigDecimal price = new BigDecimal(5000);
    BigDecimal cost = new BigDecimal(500);
    //判断策略，判断金额是否充足，费用计算，手续费计算，
    System.out.println(create(StrategyEnum.DIRECT.name()).calculate(price, cost, BuyOrSendEnum.BUY.getCode()));
    System.out.println(create(StrategyEnum.DIRECT.name()).calculate(price, cost, BuyOrSendEnum.SEND.getCode()));
  }

  public static Strategy create(String type) {
    //单种策略，多种组合策略
    if (StrategyEnum.DIRECT.name().equals(type)) {
      return new Direct();
    } else {
      return null;
    }
  }
}
